package com.zhouheng.springbootmultithreading.module.producerconsumerissues.producer;

import com.zhouheng.springbootmultithreading.module.producerconsumerissues.service.Storage;

/**
 * 生产者
 *
 * @author 周恒
 * @date 20190107 17:37:46
 * @since v1.0
 */
public class Producer extends Thread {

    private String producer;
    private Storage storage;

    public Producer(String producer, Storage storage) {
        this.producer = producer;
        this.storage = storage;
    }

    @Override
    public void run() {
        produce();
    }

    public void produce() {
        storage.produce(this.producer);
    }

}
